package com.ct.controller;

import java.util.List;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ct.entity.po.ReimbursementApprovalFi;
import com.ct.entity.query.ReimbursementApprovalFiQuery;
import com.ct.entity.vo.ResponseVO;
import com.ct.service.ReimbursementApprovalFiService;

import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotEmpty;

/**
 * 财务人员审批报销申请记录 Controller
 */
@RestController("reimbursementApprovalFiController")
@RequestMapping("/reimbursementApprovalFi")
public class ReimbursementApprovalFiController extends ABaseController {

    @Resource
    private ReimbursementApprovalFiService reimbursementApprovalFiService;

    /**
     * 根据条件分页查询
     */
    @RequestMapping("/loadDataList")
    public ResponseVO loadDataList(ReimbursementApprovalFiQuery query) {
        return getSuccessResponseVO(reimbursementApprovalFiService.findListByPage(query));
    }

    /**
     * 新增
     */
    @RequestMapping("/add")
    public ResponseVO add(ReimbursementApprovalFi bean) {
        reimbursementApprovalFiService.add(bean);
        return getSuccessResponseVO(null);
    }

    /**
     * 批量新增
     */
    @RequestMapping("/addBatch")
    public ResponseVO addBatch(@RequestBody List<ReimbursementApprovalFi> listBean) {
        reimbursementApprovalFiService.addBatch(listBean);
        return getSuccessResponseVO(null);
    }

    /**
     * 批量新增/修改
     */
    @RequestMapping("/addOrUpdateBatch")
    public ResponseVO addOrUpdateBatch(@RequestBody List<ReimbursementApprovalFi> listBean) {
        reimbursementApprovalFiService.addBatch(listBean);
        return getSuccessResponseVO(null);
    }

    /**
     * 根据ReimbursementApprovalFiId查询对象
     */
    @RequestMapping("/getReimbursementApprovalFiByReimbursementApprovalFiId")
    public ResponseVO getReimbursementApprovalFiByReimbursementApprovalFiId(Integer reimbursementApprovalFiId) {
        return getSuccessResponseVO(reimbursementApprovalFiService
                .getReimbursementApprovalFiByReimbursementApprovalFiId(reimbursementApprovalFiId));
    }

    /**
     * 根据ReimbursementApprovalFiId修改对象
     */
    @RequestMapping("/updateReimbursementApprovalFiByReimbursementApprovalFiId")
    public ResponseVO updateReimbursementApprovalFiByReimbursementApprovalFiId(ReimbursementApprovalFi bean,
            Integer reimbursementApprovalFiId) {
        reimbursementApprovalFiService.updateReimbursementApprovalFiByReimbursementApprovalFiId(bean,
                reimbursementApprovalFiId);
        return getSuccessResponseVO(null);
    }

    /**
     * 根据ReimbursementApprovalFiId删除
     */
    @RequestMapping("/deleteReimbursementApprovalFiByReimbursementApprovalFiId")
    public ResponseVO deleteReimbursementApprovalFiByReimbursementApprovalFiId(Integer reimbursementApprovalFiId) {
        reimbursementApprovalFiService
                .deleteReimbursementApprovalFiByReimbursementApprovalFiId(reimbursementApprovalFiId);
        return getSuccessResponseVO(null);
    }

    /**
     * 分页查询报销审批记录
     * 
     * @param userId   工号
     * @param pageNo   页码
     * @param pageSize 页大小
     * @return 分页结果
     */
    @RequestMapping("/getApproveReimbursementRecordFi")
    public ResponseVO getApproveReimbursementRecordFi(@NotEmpty String userId, Integer pageNo, Integer pageSize) {
        return getSuccessResponseVO(
                reimbursementApprovalFiService.getApproveReimbursementRecordFi(userId, pageNo, pageSize));
    }

    @RequestMapping("/getReimbursementApprovalFiByReimbursementId")
    public ResponseVO getReimbursementApprovalFiByReimbursementId(@RequestParam Integer reimbursementId) {
        return getSuccessResponseVO(
                reimbursementApprovalFiService.getReimbursementApprovalFiByReimbursementId(reimbursementId));
    }
}